/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package util.ejb;

import entities.tools.FilledForm;
import entities.users.FormSigner;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Marek
 */
@Local
public interface FormSignerBeanInterface {

    /**
     * Method creates new FormSigner instance
     *
     * @return new FormSigner instance
     */
    FormSigner createFormSigner();

    /**
     * Method deletes specified by detachedFormSigner entity
     *
     * @param detachedFormSigner
     * @return true if operation succeeded, false - if not
     */
    boolean deleteFormSigner(FormSigner detachedFormSigner);

    /**
     * Method returns all forms filled by, entity, set in detachedFormSigner
     * param.
     *
     * @param detachedFormSigner
     * @return List of all filled forms
     */
    List<FilledForm> getFilledForms(FormSigner detachedFormSigner);

    /**
     * Method find in the detabase entity specified by id parameter, and returns
     * this entity
     *
     * @param id
     * @return founded FormSigner
     */
    FormSigner getFormSigner(Long id);

    /**
     * Method find in the detabase entity specified by firstName, secondName,
     * phone, and email parameters, and returns it. Method returns null if no
     * users have been found.. this entity
     *
     * @param id
     * @return founded FormSigner
     */
    FormSigner getFormSigner(String firstName, String secondName, String phone, String email);

    /**
     * Method returns all FormSigner entities from the database
     *
     * @return all FormSigner from the database
     */
    List<FormSigner> getFormSigners();

    /**
     * Method updates in the database, specified by detachedFormSigner entity
     *
     * @param detachedFormSigner
     * @return true if operation succeeded, false - if not
     */
    boolean updateFormSigner(FormSigner detachedFormSigner);

    /**
     * (Dangerous) Method is bypasses security policy. Normally FormSigner
     * cannot be deleted, when he had filled some forms before. Method is
     * performing delete operation on all instances of FilledForm entity related
     * to the Form Signer, specified by pram, and than it deletes also that
     * FormSigner entity, specified by param.
     *
     * @param detachedFormSigner
     * @return true - if operation succeeded false - otherwise
     */
    public boolean forcedDeleteFormSigner(FormSigner detachedFormSigner);
}
